
Jun 16, '08 07:30:00AM • Contributed by: mundie1010
I finally realized that the Unix lsof command is exactly what one needs in this situation. I have known about lsof for a long time, but somehow never put two and two together. Now when the Finder tells me I can't eject the volume 'DODO,' I just run this in the Terminal:
lsof | grep DODO
The output may then look something like this:
bash 228 johndoe cwd DIR 14,4 4096 2 /Volumes/DODO
Word 1379 johndoe 24u REG 14,4 81 197704 /Volumes/DODO/C/Archiver/test.txt
[robg adds: This use of lsof is mentioned in the commends to a much older hint I wrote on ejecting a busy disk image using fstat. At some point in OS X's history, it seems fstat vanished (at least as an end-user program) -- I can't find it on either my 10.4 or 10.5 partition, except as a BSD system call in OS X 10.5 -- leaving the use of lsof as the preferred way of finding out what's keeping a disk image busy. Due to that change, I felt it worth running this hint as a standalone refresh of the original. If you have another method, please post it in the comments.]
[Note: This is a near-duplicate of this older hint -- thanks to hayne for pointing this out to me. However, given there's a good chain of comments here, I'm going to leave this hint up. Sorry for the duplication.]